<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="strutsTags"%>
<%@ taglib prefix="jscalendar" uri="/jscalendar"%>
<html>
	<head>
		<title>培训报表</title>
		<script type="text/javascript">
		$(function() {
			$("#tabs").tabs();
		});
	</script>
		<style type="text/css">
#tabs-1,#tabs-2,#tabs-3,#tabs-4{
	background-color: #ECF6FB;
	border-top: 1px #6BB5DA solid;
}
</style>
	</head>
	<body>
		<s:component template="bodyhead">
			<s:param name="pagetitle" value="'培训报表：'" />
			<s:param name="helpUrl" value="'37'" />
		</s:component>
		<div id="tabs">
			<ul>
				<li>
					<a href="#tabs-1" onclick="clearShow();">培训人次分析</a>
				</li>
				<li>
					<a href="#tabs-2" onclick="clearShow();">培训时间分析</a>
				</li>
				<li>
					<a href="#tabs-3" onclick="clearShow();">培训费用分析</a>
				</li>
				<li>
					<a href="#tabs-4" onclick="clearShow();">培训结果分析</a>
				</li>
			</ul>
			<div id="tabs-1">
					<p/>
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td>
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
						
					<td align="right">选择报表:</td><td><select id="select01" onchange="checkItem('select01')">
						<option value="train_count_by_dept.rptdesign">
							培训人次分析-按部门
						</option>
						<option value="train_count_by_course.rptdesign">
							培训人次分析-按课程
						</option>
						<option value="train_count_by_instructor.rptdesign">
							培训人次分析-按讲师
						</option>
					</select>
					</td>
						
				<s:select id="selectDate_select01" label="日期选项" name="selectDate" list="#{'0':'开始日期','1':'结束日期'}" ></s:select>
				<td align="right">从:</td>
				<td>
				<s:textfield  id="startDate_select01" name="startDate" required="true" size="10" maxlength="10"/>
				<img onclick="WdatePicker({el:'startDate_select01'})" class="dateimg" src="../resource/js/My97DatePicker/skin/datePicker.gif">
				</td>
				
				<td align="right">到:</td>
				<td>
				<s:textfield  id="endDate_select01" name="endDate" required="true" size="10" maxlength="10" onchange="if (!isComdate(document.getElementById('startDate_select01').value, document.getElementById('endDate_select01').value)){alert('培训开始日期必须小于培训结束日期!');document.getElementById('endDate_select01').value=''}" />
				<img onclick="WdatePicker({el:'endDate_select01'})" class="dateimg" src="../resource/js/My97DatePicker/skin/datePicker.gif">
				</td>
						</tr>
						<tr>
							<td align="right">部门:</td>
				<td>
			    <s:orgselector id="orgselector_select01"  name="departmentName" isShowPb="false" hiddenFieldName="departmentId" />
				</td>
				
				<s:select id="trinsId_select01" label="培训讲师" disabled="false" name="trinsId" list="insList" listKey="trinsId" listValue="trinsName"  required="false" multiple="false" emptyOption="true" />
				
				<td align="right">课程名称:</td>
				<td colspan="3">
				<s:select id="trcNo_select01"  disabled="false" name="trcNo" list="courseList" listKey="trcNo" listValue="trcName" required="false" multiple="false" emptyOption="true" cssStyle="width:230px;"/>
				</td>
						</tr>
					</table>
				</td>
				<td class="prompt_div_bottom">				
					<input class="button" type="button" value="查看"
						onclick="display('select01','HTML');">
					<input class="button" type="button" value="PDF下载"
						onclick="display('select01','PDF');">
				</td>
			</tr>
		</table>			
		</div>
			<div id="tabs-2">
					<p/>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td>
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
						
					<td align="right">选择报表:</td><td><select id="select02" onchange="checkItem('select02');">
						<option value="train_time_by_dept.rptdesign">
							培训时间分析-按部门
						</option>
						<option value="train_time_by_course.rptdesign">
							培训时间分析-按课程
						</option>
						<option value="train_time_by_instructor.rptdesign">
							培训时间分析-按讲师
						</option>
					</select>
					</td>
						
				<s:select id="selectDate_select02" label="日期选项" name="selectDate" list="#{'0':'开始日期','1':'结束日期'}" ></s:select>
				<td align="right">从:</td>
				<td>
				<s:textfield  id="startDate_select02" name="startDate" required="true" size="10" maxlength="10"/>
				<img onclick="WdatePicker({el:'startDate_select02'})" class="dateimg" src="../resource/js/My97DatePicker/skin/datePicker.gif">
				</td>
				
				<td align="right">到:</td>
				<td>
				<s:textfield  id="endDate_select02" name="endDate" required="true" size="10" maxlength="10" onchange="if (!isComdate(document.getElementById('startDate_select02').value, document.getElementById('endDate_select02').value)){alert('培训开始日期必须小于培训结束日期!');document.getElementById('endDate_select02').value=''}" />
				<img onclick="WdatePicker({el:'endDate_select02'})" class="dateimg" src="../resource/js/My97DatePicker/skin/datePicker.gif">
				</td>
						</tr>
						<tr>
							<td align="right">部门:</td>
				<td>
			    <s:orgselector id="orgselector_select02"  name="departmentName" isShowPb="false" hiddenFieldName="departmentId" />
				</td>
				
				<s:select id="trinsId_select02" label="培训讲师" disabled="false" name="trinsId" list="insList" listKey="trinsId" listValue="trinsName"  required="false" multiple="false" emptyOption="true" />
				<td align="right">课程名称:</td>
				<td colspan="3">
				<s:select id="trcNo_select02"  disabled="false" name="trcNo" list="courseList" listKey="trcNo" listValue="trcName" required="false" multiple="false" emptyOption="true" cssStyle="width:230px;"/>
				</td>
				</tr>
				</table>
				</td>
				<td class="prompt_div_bottom">				
					<input class="button" type="button" value="查看"
						onclick="display('select02','HTML');">
					<input class="button" type="button" value="PDF下载"
						onclick="display('select02','PDF');">
				</td>
			</tr>
		</table>	
				</div>
				
	<div id="tabs-3">
				<p/>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td>
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
						
					<td align="right">选择报表:</td><td><select id="select03" onchange="checkItem('select03');">
						<option value="train_cost_by_dept.rptdesign">
							培训费用分析-按部门
						</option>
						<option value="train_cost_by_course.rptdesign">
							培训费用分析-按课程
						</option>
						<option value="train_cost_by_instructor.rptdesign">
							培训费用分析-按讲师
						</option>
					</select>
					</td>
						
				<s:select id="selectDate_select03" label="日期选项" name="selectDate" list="#{'0':'开始日期','1':'结束日期'}" ></s:select>
				<td align="right">从:</td>
				<td>
				<s:textfield  id="startDate_select03" name="startDate" required="true" size="10" maxlength="10"/>
				<img onclick="WdatePicker({el:'startDate_select03'})" class="dateimg" src="../resource/js/My97DatePicker/skin/datePicker.gif">
				</td>
				
				<td align="right">到:</td>
				<td>
				<s:textfield  id="endDate_select03" name="endDate" required="true" size="10" maxlength="10" onchange="if (!isComdate(document.getElementById('startDate_select03').value, document.getElementById('endDate_select03').value)){alert('培训开始日期必须小于培训结束日期!');document.getElementById('endDate_select03').value=''}" />
				<img onclick="WdatePicker({el:'endDate_select03'})" class="dateimg" src="../resource/js/My97DatePicker/skin/datePicker.gif">
				</td>
						</tr>
						<tr>
							<td align="right">部门:</td>
				<td>
			    <s:orgselector id="orgselector_select03"  name="departmentName" isShowPb="false" hiddenFieldName="departmentId" />
				</td>
				<s:select id="trinsId_select03" label="培训讲师" disabled="false" name="trinsId" list="insList" listKey="trinsId" listValue="trinsName"  required="false" multiple="false" emptyOption="true" />
				<td align="right">课程名称:</td>
				<td colspan="3">
				<s:select id="trcNo_select03"  disabled="false" name="trcNo" list="courseList" listKey="trcNo" listValue="trcName" required="false" multiple="false" emptyOption="true" cssStyle="width:230px;"/>
				</td>		
						</tr>
					</table>
				</td>
				<td class="prompt_div_bottom">				
					<input class="button" type="button" value="查看"
						onclick="display('select03','HTML');">
					<input class="button" type="button" value="PDF下载"
						onclick="display('select03','PDF');">
				</td>
			</tr>
		</table>	
	</div>
	
		<div id="tabs-4">
				<p/>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td>
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
						
					<td align="right">选择报表:</td><td><select id="select04" >
						<option value="train_result_by_dept.rptdesign">
							培训结果分析
						</option>
					</select>
					</td>
						
				<s:select id="selectDate_select04" label="日期选项" name="selectDate" list="#{'0':'开始日期','1':'结束日期'}" ></s:select>
				<td align="right">从:</td>
				<td>
				<s:textfield  id="startDate_select04" name="startDate" required="true" size="10" maxlength="10"/>
				<img onclick="WdatePicker({el:'startDate_select04'})" class="dateimg" src="../resource/js/My97DatePicker/skin/datePicker.gif">
				</td>
				
				<td align="right">到:</td>
				<td>
				<s:textfield  id="endDate_select04" name="endDate" required="true" size="10" maxlength="10" onchange="if (!isComdate(document.getElementById('startDate_select04').value, document.getElementById('endDate_select04').value)){alert('培训开始日期必须小于培训结束日期!');document.getElementById('endDate_select04').value=''}" />
				<img onclick="WdatePicker({el:'endDate_select04'})" class="dateimg" src="../resource/js/My97DatePicker/skin/datePicker.gif">
				</td>
						</tr>
						<tr>
							<td align="right">部门:</td>
				<td>
			    <s:orgselector id="orgselector_select04"  name="departmentName" isShowPb="false" hiddenFieldName="departmentId" />
				</td>
				<s:select id="trinsId_select04" label="培训讲师" disabled="false" name="trinsId" list="insList" listKey="trinsId" listValue="trinsName"  required="false" multiple="false" emptyOption="true" />
				<td align="right">课程名称:</td>
				<td colspan="3">
				<s:select id="trcNo_select04"  disabled="false" name="trcNo" list="courseList" listKey="trcNo" listValue="trcName" required="false" multiple="false" emptyOption="true" cssStyle="width:230px;"/>
				</td>
						</tr>
				<tr>
				<td colspan="20">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr align="center">
					A:(<s:textfield id="a_low" name="tr_degree.a_low" cssStyle="width:30px;" value="90" onkeypress="MKeyIsNumber();" maxlength="3"/>-<s:textfield id="a_height" name="tr_degree.a_height" cssStyle="width:30px;" value="100" onkeypress="MKeyIsNumber();" maxlength="3"/>)
					B:(<s:textfield id="b_low" name="tr_degree.b_low" cssStyle="width:30px;" value="80" onkeypress="MKeyIsNumber();" maxlength="3"/>-<s:textfield id="b_height" name="tr_degree.b_height" cssStyle="width:30px;" value="90" onkeypress="MKeyIsNumber();" maxlength="3"/>)
					C:(<s:textfield id="c_low" name="tr_degree.c_low" cssStyle="width:30px;" value="70" onkeypress="MKeyIsNumber();" maxlength="3"/>-<s:textfield id="c_height" name="tr_degree.c_height" cssStyle="width:30px;" value="80" onkeypress="MKeyIsNumber();" maxlength="3"/>)
					D:(<s:textfield id="d_low" name="tr_degree.d_low" cssStyle="width:30px;" value="60" onkeypress="MKeyIsNumber();" maxlength="3"/>-<s:textfield id="d_height" name="tr_degree.d_height" cssStyle="width:30px;" value="70" onkeypress="MKeyIsNumber();" maxlength="3"/>)
					E:(<s:textfield id="e_low" name="tr_degree.e_low" cssStyle="width:30px;" value="0" onkeypress="MKeyIsNumber();" maxlength="3"/>-<s:textfield id="e_height" name="tr_degree.e_height" cssStyle="width:30px;" value="60" onkeypress="MKeyIsNumber();" maxlength="3"/>)
					</tr>
					</table>
				</td>
				</tr>	
						
					</table>
				</td>
				<td rowspan="3"  class="prompt_div_bottom">				
					<input class="button" type="button" value="查看"
						onclick="display('select04','HTML');">
					<input class="button" type="button" value="PDF下载"
						onclick="display('select04','PDF');">
				</td>
			</tr>
		</table>	
	</div>
</div>
		<p>
			&nbsp;
		</p>
				<IFRAME ID="reportArea" name="reportArea" marginWidth="0"
					marginHeight="0" frameborder="0" align="left" width="100%"
					height="480" src="" style="overflow-y: auto;">
				</IFRAME>

	<script type="text/javascript">
	// 设定定时器
	var MyInterval;
				
	function viewReport(reportFileLocation,format,id){
		var baseReportURL = "../report/trainingReport.action";
        var baseEmployeeReportFolador = "/report/training/";
        var resultURL = baseReportURL +"?reportFormat="+format+"&reportFileLocation="+baseEmployeeReportFolador+reportFileLocation;
        if(reportFileLocation == "train_result_by_dept.rptdesign"){
			e_low = $('#e_low').val();
			e_height = $('#e_height').val();
			if((isEmpty(e_low) && !isEmpty(e_height)) || (!isEmpty(e_low) && isEmpty(e_height))){
				alert("等级值段区间E必须成对填写！");
				return;
			}
			if(isEmpty(e_low) && isEmpty(e_low) && e_height<e_low){
				alert("等级值段区间E下限必须小于上限！");
				return;
			}
			d_low = $('#d_low').val();
			d_height = $('#d_height').val();
			if((isEmpty(d_low) && !isEmpty(d_height)) || (!isEmpty(d_low) && isEmpty(d_height))){
				alert("等级值段区间D必须成对填写！");
				return;
			}
			if(isEmpty(d_low) && isEmpty(d_low) && d_height<d_low){
				alert("等级值段区间D下限必须小于上限！");
				return;
			}
			c_low = $('#c_low').val();
			c_height = $('#c_height').val();
			if((isEmpty(c_low) && !isEmpty(c_height)) || (!isEmpty(c_low) && isEmpty(c_height))){
				alert("等级值段区间C必须成对填写！");
				return;
			}
			if(isEmpty(c_low) && isEmpty(c_low) && c_height<c_low){
				alert("等级值段区间C下限必须小于上限！");
				return;
			}
			b_low = $('#b_low').val();
			b_height = $('#b_height').val();
			if((isEmpty(b_low) && !isEmpty(b_height)) || (!isEmpty(b_low) && isEmpty(b_height))){
				alert("等级值段区间B必须成对填写！");
				return;
			}
			if(isEmpty(b_low) && isEmpty(b_low) && b_height<b_low){
				alert("等级值段区间B下限必须小于上限！");
				return;
			}
			a_low = $('#a_low').val();
			a_height = $('#a_height').val();
			if((isEmpty(a_low) && !isEmpty(a_height)) || (!isEmpty(a_low) && isEmpty(a_height))){
				alert("等级值段区间A必须成对填写！");
				return;
			}
			if(isEmpty(a_low) && isEmpty(a_low) && a_height<a_low){
				alert("等级值段区间A下限必须小于上限！");
				return;
			}
			resultURL += "&tr_degree.e_low="+e_low+"&tr_degree.e_height="+e_height+"&tr_degree.d_low="+d_low+"&tr_degree.d_height="+d_height+"&tr_degree.c_low="+c_low+"&tr_degree.c_height="+c_height+
					"&tr_degree.b_low="+b_low+"&tr_degree.b_height="+b_height+"&tr_degree.a_low="+a_low+"&tr_degree.a_height="+a_height;
        }
		MyInterval=window.setInterval("hideDia()",500);
		$('#divWait').show();
       resultURL+="&selectDate="+$('#selectDate_'+id).select().val();
       resultURL+="&newStartDate="+$('#startDate_'+id).val();
       resultURL+="&newEndDate="+$('#endDate_'+id).val();
       resultURL+="&departmentId="+$('#orgselector_returnString_orgselector_'+id).val();
       resultURL+="&trcNo="+$('#trcNo_'+id).val();
       resultURL+="&trinsId="+$('#trinsId_'+id).val();
       if(id == 'select03'){
       		resultURL+="&costType="+$('#costType').select().val();
       }
        $("#reportArea").attr("src",resultURL);
    }
    function display(id,format){
        var reportFileLocation = $("#"+id).val();
        if(reportFileLocation == ''){
            return;
        }
        viewReport(reportFileLocation,format,id);
    }
    
    function hideDia(){
    	if($('#reportArea').contents().find('img')[0] != null || $('#reportArea').contents().find('div:last').text() != ""){
    		window.clearInterval(MyInterval);
    		$('#divWait').hide();
    	}
   	}
     
	//清楚页面中reportArea的内容。
	function clearShow(){
	 	 $("#reportArea").attr("src",'');
	}
	
	function checkItem(selectId){
		var object = document.getElementById(selectId);
		var temp = object.options[object.selectedIndex].text;
		temp = temp.substring(7);
		if(temp == '按课程'){
			$('#trcNo_'+selectId).attr('disabled',true);
			$('#trinsId_'+selectId).attr('disabled',false);
			$('#trcNo_'+selectId).val('');
		} else if(temp == '按讲师'){
			$('#trcNo_'+selectId).attr('disabled',false);
			$('#trinsId_'+selectId).attr('disabled',true);
			$('#trinsId_'+selectId).val('');
		} else {
			$('#trinsId_'+selectId).attr('disabled',false);
			$('#trcNo_'+selectId).attr('disabled',false);
		}
	}

	// 判断字段内容是否为空
	function isEmpty(field){
		if(field == null || field.trim() == "" || field.length == 0) return true;
		return false;
	}
</script>
<jsp:include page="../../sitemesh/div_wait.jsp" flush="true"></jsp:include>
</body>
</html>
